package com.ruoyi.system.service.car4s_service.car4s_impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.car4s_mapper.Car4sCustomerInfoMapper;
import com.ruoyi.system.domain.car4s_domain.Car4sCustomerInfo;
import com.ruoyi.system.service.car4s_service.ICar4sCustomerInfoService;

/**
 * 客户信息Service业务层处理
 * 
 * @author LK
 * @date 2024-06-29
 */
@Service
public class Car4sCustomerInfoServiceImpl implements ICar4sCustomerInfoService 
{
    @Autowired
    private Car4sCustomerInfoMapper car4sCustomerInfoMapper;

    /**
     * 查询客户信息
     * 
     * @param customerId 客户信息主键
     * @return 客户信息
     */
    @Override
    public Car4sCustomerInfo selectCar4sCustomerInfoByCustomerId(Long customerId)
    {
        return car4sCustomerInfoMapper.selectCar4sCustomerInfoByCustomerId(customerId);
    }
    /**
     * 查询客户信息  通过手机号
     *
     * @param phoneNum 客户电话
     * @return 客户信息
     */
    @Override
    public Car4sCustomerInfo selectCar4sCustomerInfoByPhoneNum(String phoneNum)
    {
        Car4sCustomerInfo customerInfo = new Car4sCustomerInfo();
        customerInfo.setContactInfo(phoneNum);
        List<Car4sCustomerInfo> car4sCustomerInfos = car4sCustomerInfoMapper.selectCar4sCustomerInfoList(customerInfo);
        if(car4sCustomerInfos.size()>0){
            return car4sCustomerInfos.get(0);
        }else {
            return new Car4sCustomerInfo();
        }
    }


    /**
     * 查询客户信息列表
     * 
     * @param car4sCustomerInfo 客户信息
     * @return 客户信息
     */
    @Override
    public List<Car4sCustomerInfo> selectCar4sCustomerInfoList(Car4sCustomerInfo car4sCustomerInfo)
    {
        return car4sCustomerInfoMapper.selectCar4sCustomerInfoList(car4sCustomerInfo);
    }

    /**
     * 新增客户信息
     * 
     * @param car4sCustomerInfo 客户信息
     * @return 结果
     */
    @Override
    public int insertCar4sCustomerInfo(Car4sCustomerInfo car4sCustomerInfo)
    {
        return car4sCustomerInfoMapper.insertCar4sCustomerInfo(car4sCustomerInfo);
    }

    /**
     * 修改客户信息
     * 
     * @param car4sCustomerInfo 客户信息
     * @return 结果
     */
    @Override
    public int updateCar4sCustomerInfo(Car4sCustomerInfo car4sCustomerInfo)
    {
        return car4sCustomerInfoMapper.updateCar4sCustomerInfo(car4sCustomerInfo);
    }

    /**
     * 批量删除客户信息
     * 
     * @param customerIds 需要删除的客户信息主键
     * @return 结果
     */
    @Override
    public int deleteCar4sCustomerInfoByCustomerIds(Long[] customerIds)
    {
        return car4sCustomerInfoMapper.deleteCar4sCustomerInfoByCustomerIds(customerIds);
    }

    /**
     * 删除客户信息信息
     * 
     * @param customerId 客户信息主键
     * @return 结果
     */
    @Override
    public int deleteCar4sCustomerInfoByCustomerId(Long customerId)
    {
        return car4sCustomerInfoMapper.deleteCar4sCustomerInfoByCustomerId(customerId);
    }
}
